package com.example.demo.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
/**
 * 生成表结构如下：
 * MariaDB [haha]> desc stu;
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| sid       | int(11)      | NO   | PRI | NULL    | auto_increment |
| birthday  | datetime     | YES  |     | NULL    |                |
| address   | varchar(255) | YES  |     | NULL    |                |
| post_code | varchar(255) | YES  |     | NULL    |                |
| gender    | varchar(255) | YES  |     | NULL    |                |
| major     | varchar(255) | YES  |     | NULL    |                |
| sname     | varchar(255) | YES  |     | NULL    |                |
+-----------+--------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)

 * @author mill
 *
 */
@Entity(name="stu")
public class Students implements Serializable{

	private static final long serialVersionUID = 1L;
	@Id //必须在字段或get方法，多个主键需要实现Serializable接口
	@GeneratedValue
	private Integer sid;
	
//	@Id
//	@Column(length=20) //字符串主键的长度有限制
//	@GeneratedValue(generator="asi")
//	@GenericGenerator(name="asi",strategy="assigned") //字符串主键的生成策略
	private String sname;
	private String gender;
	private Date birthday;
	@Transient //这个字段不映射
	private String major;
	private Address data;
	public Integer getSid() {
		return sid;
	}
	public void setSid(Integer sid) {
		this.sid = sid;
	}
	public String getSname() {
		return sname;
	}
	public void setSname(String sname) {
		this.sname = sname;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getMajor() {
		return major;
	}
	public void setMajor(String major) {
		this.major = major;
	}
	public Address getData() {
		return data;
	}
	public void setData(Address data) {
		this.data = data;
	}
	
	
}
